Add version-matrix command for Python version detection#75
Merged
Conversation
Provides a unified interface for determining supported Python versions from pyproject.toml, making it easier to use in scripts and CI workflows alongside other rhiza-tools commands. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements 44 tests covering all functions and edge cases: - parse_version: handles valid versions, suffixes, and invalid inputs - _check_operator: tests all comparison operators (>=, <=, >, <, ==, !=) - satisfies: validates single/multiple specifiers and complex combinations - get_supported_versions: covers success cases and error conditions - version_matrix_command: tests defaults, custom options, and error handling Coverage: 78 statements, 0 missed (100%) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Removes the module from sys.modules before using runpy.run_module() to avoid the warning: "module found in sys.modules after import of package but prior to execution; this may result in unpredictable behaviour" The fix ensures clean module execution by temporarily removing the module from sys.modules and restoring it afterwards, eliminating the warning while maintaining test coverage. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Renamed test_version_matrix.py to test_version_matrix_command.py to avoid naming conflict with .rhiza/tests/utils/test_version_matrix.py which tests the original utility script. This resolves the pytest error: "imported module 'test_version_matrix' has this __file__ attribute which is not the same as the test file we want to collect" Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds two test cases to test_cli_commands.py that cover the CLI wrapper function for version-matrix, testing both default and custom candidate parsing. This brings test coverage from 99% to 100%. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
version-matrixcommand to rhiza-tools CLIpyproject.tomlrequires-pythonspecifier.rhiza/utils/version_matrix.pyscriptFeatures
rhiza-tools version-matrixoutputs supported versions as JSON--pyproject: Specify custom path to pyproject.toml--candidates: Provide custom list of candidate versions to evaluateUsage
Test plan
make mypy)make fmt)make version-matrixstill works🤖 Generated with Claude Code